/**
 * 
 */
package homework5;

import java.util.LinkedList;

/**
 * @author Nican
 *
 */
public class NewFlights extends NetworkFinderAbstract<Node> {

	/**
	 * @param graph
	 * Find list of city pairs to have one complete graph
	 */
	public NewFlights(Graph graph) {
		super(graph);
	}
	
	public LinkedList<CityPair> getNewFlights(){
		
		LinkedList<CityPair> list = new LinkedList<CityPair> ();
		LinkedList<LinkedList<Node>> subGraphs = this.finalSubGraphs();
		
		Node hub = subGraphs.removeFirst().getFirst();
		
		for( LinkedList<Node> nodeList : subGraphs ){
			list.add( new CityPair(nodeList.getFirst(), hub) );			
		}
		
		return list;
	}

	/* (non-Javadoc)
	 * @see homework5.NetworkFinderAbstract#getNodeValue(homework5.Node)
	 */
	@Override
	protected Node getNodeValue(Node e) {
		return e;
	}

}
